import { App as AntApp, ConfigProvider } from 'antd';
import './app.css';
import React from 'react';
import zhCN from 'antd/locale/zh_CN';
import { RouterView } from '@/router/routerView';
import ThemeConfig from '@/config/theme';
import { setStorage } from '@/utils/storage';

if (window.location.pathname === '/') {
  window.location.href = '/home';
  setStorage('witKeyPath', ['/home']);
  document.title = '首页';
}

const App = () => (
  <ConfigProvider
    theme={{
      token: {
        colorPrimary: '#1677ff',
      },
    }}
    locale={zhCN}
  >
    <AntApp
      message={{ maxCount: ThemeConfig.maxCount, duration: ThemeConfig.messageDuration }}
      notification={{ placement: ThemeConfig.placement, maxCount: ThemeConfig.maxCount }}
    >
      <RouterView />
    </AntApp>
  </ConfigProvider>
);

export default App;
